﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls;
using Microsoft.Practices.Prism.Modularity;
using Microsoft.Practices.Prism.Regions;
using Microsoft.Practices.Prism.Logging;
using Microsoft.Practices.Prism.Mvvm;
using Microsoft.Practices.Unity;
using Models;
using Views;
using ViewModels;
using Interfaces;

namespace Modules
{
    public class NewsModule : IModule
    {
        private readonly IRegionManager _regionManager;
        private readonly IUnityContainer _container;
        private readonly ILoggerFacade _logger;

        public NewsModule(ILoggerFacade logger, IRegionManager regionManager, IUnityContainer container)
        {
            _regionManager = regionManager;
            _container = container;
            _logger = logger;
        }

        public void Initialize()
        {
            _container.RegisterType(typeof(INewsModel), typeof(NewsModel));
            _container.RegisterType(typeof(INewsViewModel), typeof(NewsViewModel));

            _regionManager.RegisterViewWithRegion("NewsMainRegion", typeof(NewsMainView));
            _regionManager.RegisterViewWithRegion("NewsControlRegion", typeof(NewsControlView));
            _regionManager.RegisterViewWithRegion("NewsRegion", typeof(NewsGridView));
        }
    }
}
